package com.taojin.shoppinginterest.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.taojin.shoppinginterest.R;

import java.util.List;

/**
 * Created by T400 on 15-5-13.
 */
public class MyAdapter extends AppAdapter<String > {
    public MyAdapter(List<String> list, Context context) {
        super(list, context);
    }

    @Override
    public View createItemView(int position, View convertView, ViewGroup parent) {
        ViewHolder vh;
        if(convertView==null){
            convertView=inflater.inflate(R.layout.item_favorablefragment_pop,null);
            vh=new ViewHolder(convertView);
            convertView.setTag(vh);
        }else{
            vh= (ViewHolder) convertView.getTag ();
        }
        vh.textView.setText(list.get(position));

        return convertView;
    }
    class ViewHolder{
        @ViewInject(R.id.pop_tv)
        TextView textView;

        public ViewHolder(View convertView) {
            ViewUtils.inject(this,convertView);
        }
    }
}
